package com.sxt.websocket.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import com.sxt.websocket.consts.Const;
import com.sxt.websocket.service.TaskService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
public class TaskServiceImpl implements TaskService{
	//这个就是我们可以指定频道推送对应数据的对象
	
    @Autowired
    private SimpMessagingTemplate simpMessagingTemplate;
	
	@Scheduled(cron="0/10 * *  * * ? ")   //CRON表达式每10秒执行一次
	@Override
	public void selectCurDayDepotOrderInfo() {
		log.info("=====================AAA频道每10秒执行一次刷新=====================");
		simpMessagingTemplate.convertAndSend(Const.Channel.AAA_CHANNEL.getName(),"AAA频道!!INFO");
	}

	@Scheduled(cron="0/13 * *  * * ? ") //CRON表达式每13秒执行一次
	@Override
	public void selectCustomerOrderInfo() {
		log.info("=====================BBB频道每13秒执行一次刷新=====================");
		simpMessagingTemplate.convertAndSend(Const.Channel.BBB_CHANNEL.getName(), "BBB频道!!INFO");
	}

}
